<%--
  Created by IntelliJ IDEA.
  User: cgl
  Date: 2021/6/7
  Time: 10:49
  To change this template use File | Settings | File Templates.
--%>
<%@page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">

    <title>My JSP 'MyJsp.jsp' starting page</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
    <meta charset="UTF-8">
    <title>用户登录</title>
    <link rel="stylesheet" type="text/css" href="css/css1/userLogin.css"/>
    <script src="js/js1/jquery-3.6.0.min.js"></script>
    <script src="js/js1/userLogin.js" type="text/javascript"></script>
    <link rel="stylesheet" href="css/shutter.css">
    <script type="text/javascript" charset="utf-8" src="//g.alicdn.com/sd/ncpc/nc.js?t=2015052012"></script>
    <script type="text/javascript">
        if(${zhucexinxi!="null"}){
            alert("${zhucexinxi}");
        }
    </script>
</head>

<body  style="background-color: white;">
<br />
<!--标题栏-->
<div class="head-frame">
    <div class="head-panel">
        <img src="img/logo.png" />
        <div class="search">
            <input class="search-field" type="text" />
            <img src="img/icon_search.png" />
        </div>
        <div class="ctrl">
            <c:if test="${User== null }">
                <div class="my12306">我的12306</div>
                <div class="line"></div>
                <div class="font">登录</div>
                <div class="font" onclick="window.location='info.html'">注册</div>
            </c:if>
            <c:if test="${User!= null }">
                <div class="my12306" style="float: right">亲爱的用户,${User.userName}</div>
                <div class="font" style="float: right">我的订单</div>
                <div class="font" style="float: right" onclick="tcdl()">退出登录</div>
            </c:if>
            <script type="text/javascript">
                function tcdl() {
                    location="login/tcdl";
                }
            </script>
        </div>
    </div>
</div>
<br />
<!--菜单栏-->
<div class="menu-frame">
    <div class="menu-panel">
        <div class="menuValue item" onclick="toshouye()">首页</div>
        <div class="menuValue">车票</div>
        <div class="menuValue">团购服务</div>
        <div class="menuValue">会员服务</div>
        <div class="menuValue">车站服务</div>
        <div class="menuValue">商旅服务</div>
        <div class="menuValue">出行指南</div>
    </div>
    <script type="text/javascript">
        function toshouye() {
            location="login/Login";
        }
        function hqyzm() {
            var mobile=$("#userTel").val();
            $.post("login/sjyz",{mobile:mobile},function (date) {
                if(date!=0){
                    $("#yzmtsk").html("已获取验证码");
                    $("#yzmzqf").html("请输入验证码");
                    $("#yzmyc").val(date);
                }else{
                    $("#yzmtsk").html("获取失败，请重试");
                }
            });
        }
        function yzmyz() {
            var yzm= $("#yzmyc").val();
            var sr=$("#yzm").val();
            if(sr==null || sr==""){

            }else{
                if(sr==yzm){
                    $("#yzmzqf").html("验证码正确");
                    var yzm= $("#yzmyc").val("true");
                }else{
                    $("#yzmzqf").html("请输入验证码");
                }
            }
        }
    </script>
</div>
        <form id="zcform" action="login/zhuce" method="post" style="margin: 0 auto;width: 600px">
            <table  cellspacing="25px">
                <tr>
                    <td colspan="3">账号</td>
                    <td colspan="5"><input type="text" id="userAccount" name="userAccount" placeholder="请输入账号" style="width: 200px"></td>
                </tr>
                <tr>
                    <td colspan="3">密码</td>
                    <td colspan="5"><input type="password" id="userPwd" name="userPwd" placeholder="请输入密码" style="width: 200px"></td>
                </tr>
                <tr>
                    <td colspan="3">用户名</td>
                    <td colspan="5"><input type="text" id="userName" name="userName" placeholder="请输入用户名" style="width: 200px"></td>
                </tr>
                <tr>
                    <td colspan="3">证件类型</td>
                    <td colspan="5"><select name="idType" id="idType" style="width: 200px">
                        <option value="1">身份证</option>
                        <option value="3">护照</option>
                        <option value="3">港澳通行证</option>
                    </select></td>
                </tr>
                <tr>
                    <td colspan="3">证件号码</td>
                    <td colspan="5"><input type="text" id="idNumber" name="idNumber" placeholder="请输入证件号码" style="width: 200px"></td>
                </tr>
                <tr>
                    <td colspan="3">性别</td>
                    <td colspan="5"><select name="sexType" id="sexType" style="width: 200px">
                        <option value="4">男</option>
                        <option value="5">女</option>
                    </select></td>
                </tr>
                <tr>
                    <td colspan="3">手机号</td>
                    <td colspan="5"><input type="text" name="userTel" id="userTel" placeholder="请输入手机号码"style="width: 200px"></td>
                    <td ><input type="button" value="获取验证码" style="width: 100px" onclick="hqyzm()"/></td>
                    <td><p id="yzmtsk" style="width: 100px"></p></td>
                </tr>
                <tr>
                    <td colspan="3">验证码</td>
                    <td colspan="5"><input type="text" name="yzm" id="yzm" placeholder="请输入验证码" style="width: 200px" oninput="yzmyz()"/></td>
                    <td><p id="yzmzqf"></p></td>
                </tr>
                    <input type="hidden" name="yzmyc" id="yzmyc">
                <tr>
                    <td colspan="3">乘客类型</td>
                    <td colspan="5"><select name="passengerType" id="passengerType" style="width: 200px">
                        <option value="6">成人</option>
                        <option value="7">学生</option>
                    </select></td>
                </tr>
                <tr>
                    <td colspan="3">联系人姓名</td>
                    <td colspan="5"><input type="text" id="contactName" name="contactName" placeholder="请输入联系人姓名" style="width: 200px"></td>
                </tr>
                <tr>
                    <td colspan="3">联系人手机号</td>
                    <td colspan="5"><input type="text" id="contactTle" name="contactTle" placeholder="请输入联系人手机号" style="width: 200px"></td>
                </tr>
                <tr>
                    <td colspan="3">

                    </td>
                    <td>
                        <input type="button" value="注册" onclick="tjzc()" style="width: 100px">
                    </td>
                </tr>
            </table>
        </form>
        <script type="text/javascript">
            function tjzc() {
                var list=[];
                list.push($("#userAccount").val());
                list.push($("#userPwd").val());
                list.push($("#userName").val());
                list.push($("#idType").val());
                list.push($("#idNumber").val());
                list.push($("#sexType").val());
                list.push($("#userTel").val());
                list.push($("#passengerType").val());
                list.push($("#contactName").val());
                list.push($("#contactTle").val());
                var falg=true;
                for(var i=0;i<list.length;i++){
                    if(list[i]==null){
                        falg=false;
                        break;
                    }
                    if(list[i]==""){
                        falg=false;
                        break;
                    }
                }
                if(falg){
                    if($("#yzmyc").val()=="true"){
                        $("#zcform").submit();
                    }else {
                        alert("请进行手机验证")
                    }
                }else{
                    alert("请将信息填写完整");
                }
            }
        </script>

</body>
</html>

